package com.czxy.dao;

import com.czxy.domain.Order;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface OrderMapper extends Mapper<Order> {


    // 根据用户id 查询 所有的订单
    @Select("select * from orders where uid = #{uid} order by ordertime desc")
    @Results({
            @Result(property = "oid",column = "oid"),
            @Result(property = "itemList",
            many = @Many(select = "com.czxy.dao.OrderItemMapper.findOrderItemsByOid"),
            column = "oid")
    })
    public List<Order> findOrdersByUid(@Param("uid") String uid);
}
